#include <iostream>
#include <vector>

using namespace std;

int main()
{
    vector<int> arr;
    int count = 10000;
    int f = 500;
    for(int i = 0; i < count; i++)
        arr.append(i);

    // 1. 循环遍历
    // for(int i = 0; i < count; i++) {
    //     if(arr.at(i) == f) {
    //         cout << "i = " << i << ", data = " << arr.at(i) << endl;
    //         break;
    //     }
    // }

    // 2. 折半查找
    int index = count / 2;
    while(att.at(index) != f) {
        if(arr.at(index) > f) {
            count = index;
            index = count / 2;
        }
        else {
            index = (count - index) / 2 + index;
        }
    }
    

    return 0;
}